# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Language.V2.Model.XPSConfidenceMetricsEntry do
  @moduledoc """
  ConfidenceMetricsEntry includes generic precision, recall, f1 score etc. Next tag: 16.

  ## Attributes

  *   `confidenceThreshold` (*type:* `number()`, *default:* `nil`) - Metrics are computed with an assumption that the model never return predictions with score lower than this value.
  *   `f1Score` (*type:* `number()`, *default:* `nil`) - The harmonic mean of recall and precision.
  *   `f1ScoreAt1` (*type:* `number()`, *default:* `nil`) - The harmonic mean of recall_at1 and precision_at1.
  *   `falseNegativeCount` (*type:* `String.t`, *default:* `nil`) - The number of ground truth labels that are not matched by a model created label.
  *   `falsePositiveCount` (*type:* `String.t`, *default:* `nil`) - The number of model created labels that do not match a ground truth label.
  *   `falsePositiveRate` (*type:* `number()`, *default:* `nil`) - False Positive Rate for the given confidence threshold.
  *   `falsePositiveRateAt1` (*type:* `number()`, *default:* `nil`) - The False Positive Rate when only considering the label that has the highest prediction score and not below the confidence threshold for each example.
  *   `positionThreshold` (*type:* `integer()`, *default:* `nil`) - Metrics are computed with an assumption that the model always returns at most this many predictions (ordered by their score, descendingly), but they all still need to meet the confidence_threshold.
  *   `precision` (*type:* `number()`, *default:* `nil`) - Precision for the given confidence threshold.
  *   `precisionAt1` (*type:* `number()`, *default:* `nil`) - The precision when only considering the label that has the highest prediction score and not below the confidence threshold for each example.
  *   `recall` (*type:* `number()`, *default:* `nil`) - Recall (true positive rate) for the given confidence threshold.
  *   `recallAt1` (*type:* `number()`, *default:* `nil`) - The recall (true positive rate) when only considering the label that has the highest prediction score and not below the confidence threshold for each example.
  *   `trueNegativeCount` (*type:* `String.t`, *default:* `nil`) - The number of labels that were not created by the model, but if they would, they would not match a ground truth label.
  *   `truePositiveCount` (*type:* `String.t`, *default:* `nil`) - The number of model created labels that match a ground truth label.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :confidenceThreshold => number() | nil,
          :f1Score => number() | nil,
          :f1ScoreAt1 => number() | nil,
          :falseNegativeCount => String.t() | nil,
          :falsePositiveCount => String.t() | nil,
          :falsePositiveRate => number() | nil,
          :falsePositiveRateAt1 => number() | nil,
          :positionThreshold => integer() | nil,
          :precision => number() | nil,
          :precisionAt1 => number() | nil,
          :recall => number() | nil,
          :recallAt1 => number() | nil,
          :trueNegativeCount => String.t() | nil,
          :truePositiveCount => String.t() | nil
        }

  field(:confidenceThreshold)
  field(:f1Score)
  field(:f1ScoreAt1)
  field(:falseNegativeCount)
  field(:falsePositiveCount)
  field(:falsePositiveRate)
  field(:falsePositiveRateAt1)
  field(:positionThreshold)
  field(:precision)
  field(:precisionAt1)
  field(:recall)
  field(:recallAt1)
  field(:trueNegativeCount)
  field(:truePositiveCount)
end

defimpl Poison.Decoder, for: GoogleApi.Language.V2.Model.XPSConfidenceMetricsEntry do
  def decode(value, options) do
    GoogleApi.Language.V2.Model.XPSConfidenceMetricsEntry.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Language.V2.Model.XPSConfidenceMetricsEntry do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
